﻿using System;
using System.Collections;

namespace HashtableText
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            ht.Add(1, "1+1,答案为2");
            ht.Add(2, "1+2，答案为3");
            ht.Add(3, "1+3，答案为4");

            ht[4] = "嘤嘤嘤";//另一种添加方式


           // ht.Clear();
            ht.Remove(1);//移除1


            Console.WriteLine("请输入你所选择的题目");


            int id = int.Parse(Console.ReadLine());
            bool flag = ht.ContainsKey(id);
            if (flag)
            {
                Console.WriteLine("题目是"+ht[id].ToString());
            }
            else
            {
                Console.WriteLine("题目不存在");
            }



            foreach (DictionaryEntry d in ht)
            {
                int k = (int)d.Key;
                string v = d.Value.ToString();
                Console.WriteLine("题目序号：{0}，题目：{1}", k, v);
                
            }

            

        }
    }
}
